<template>
	<view class="pageContainer myBackground" :style="{height: `${windowHeight}px`}">
		<view class="pl15 pr15 h100p w100p boxSizing">
			<scroll-view scroll-y class="h100p w100p">
				<view class="pb20" v-for="(item,index) in imgListData" :key="index">
					<view class="d-flex a-center mb15">
						<view class="d-flex-center mr10">
							<image style="width: 36px; height: 36px;" mode="aspectFill" :src="item.menuIcon">
							</image>
						</view>
						<view class="">
							<view class="titleName fs18">{{item.menuName}}</view>
						</view>
					</view>
					<view class="d-flex flex-wrap a-center j-sb">
						<view class="item_box d-flex-center mb15 fs16" v-for="(itemY,indexY) in item.children" :key="indexY"
							@click="gotoPage(itemY, menuName)">
							{{itemY.menuName}}
						</view>
					</view>
				</view>
			</scroll-view>
		</view>

		<!-- <view style="width: 100%;height: calc(120rpx + env(safe-area-inset-bottom) / 2);"></view> -->
		<!-- <tab-bar-view :tabCode="'1'"></tab-bar-view> -->
	</view>
</template>

<script>
	import {

	} from "@/api/index.js"

	export default {
		data() {
			return {
				menuName: "",
				imgListData: [{
					menuName: "宿舍1号楼",
					menuIcon: "/static/img/feature/children/build.png",
					children: [{
							menuName: "1号楼汇总",
							menuIcon: "dg-1"
						},
						{
							menuName: "1号楼1层",
							menuIcon: "1-1"
						},
						{
							menuName: "1号楼2层",
							menuIcon: "1-2"
						},
						{
							menuName: "1号楼3层",
							menuIcon: "1-3"
						},
						{
							menuName: "1号楼4层",
							menuIcon: "1-4"
						},
						{
							menuName: "1号楼5层",
							menuIcon: "1-5"
						},
					]
				}, {
					menuName: "宿舍2号楼",
					menuIcon: "/static/img/feature/children/build.png",
					children: [{
							menuName: "2号楼汇总",
							menuIcon: "dg-2"
						},
						{
							menuName: "2号楼1层",
							menuIcon: "2-1"
						},
						{
							menuName: "2号楼2层",
							menuIcon: "2-2"
						},
						{
							menuName: "2号楼3层",
							menuIcon: "2-3"
						},
						{
							menuName: "2号楼4层",
							menuIcon: "2-4"
						},
						{
							menuName: "2号楼5层",
							menuIcon: "2-5"
						},
					]
				}, {
					menuName: "宿舍3号楼",
					menuIcon: "/static/img/feature/children/build.png",
					children: [{
							menuName: "3号楼汇总",
							menuIcon: "dg-3"
						},
						{
							menuName: "3号楼1层",
							menuIcon: "3-1"
						},
						{
							menuName: "3号楼2层",
							menuIcon: "3-2"
						},
						{
							menuName: "3号楼3层",
							menuIcon: "3-3"
						},
						{
							menuName: "3号楼4层",
							menuIcon: "3-4"
						},
						{
							menuName: "3号楼5层",
							menuIcon: "3-5"
						},
					]
				}, ]
			};
		},
		computed: {
			windowHeight() {
				return uni.getSystemInfoSync().windowHeight
			}
		},
		onLoad(query) {
			this.menuName = query.menuName
			uni.setNavigationBarTitle({
				title: query.menuName
			})
		},
		onShow() {},
		onReady() {
			// 隐藏导航栏
			uni.hideTabBar({});
		},
		methods: {
			gotoPage(data, type) {
				let menuPath = ""
				switch (type) {
					case '运行数据':
						menuPath = '/pages/featureCenter/children/operationData'
						break;
					case '设备控制':
						menuPath = '/pages/featureCenter/children/control'
						break;
					case '故障记录':
						menuPath = '/pages/featureCenter/children/breakdown'
						break;
					case '负载分析':
						menuPath = '/pages/featureCenter/children/loadAnalysis'
						break;
					case '能耗分析':
						menuPath = '/pages/featureCenter/children/energyAnalysis'
						break;
					case '控制记录':
						menuPath = '/pages/featureCenter/children/controlReport'
						break;
					default:
						// 如果 expression 不匹配任何 case 值，则执行 default 子句中的代码块  
						break;
				}
				uni.navigateTo({
					url: menuPath + '?activeMenu=' + data.menuIcon
				});
			}
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}

	.pageContainer {
		// padding-top: calc(var(--status-bar-height) + 30rpx);
		box-sizing: border-box;
		font-family: "黑体", "Heiti SC", "STHeiti", sans-serif;

		.titleName {
			// font-family: Source Han Sans CN, Source Han Sans CN-500;
			font-weight: 500;
			color: #4c4c4c;
			font-weight: 600;
		}

		.item_box {
			width: 332rpx;
			height: 128rpx;
			background: linear-gradient(92deg, #77beff 0%, #a269ff 100%);
			border-radius: 24rpx;
			box-shadow: 0px 0px 20rpx 0px rgba(21, 20, 107, 0.28);
			color: #ffffff;
		}
	}
</style>